perm filename DVIDOV.LST[MF,DEK] blob sn#749685 filedate 1984-04-08 generic text, type T, neo UTF8
  1) DVIDOV.SAI[MF,DEK] and 2) DVIDOV.SAI[1,JDH]	4-08-84 16:25	pages 1,1

**** File 1) DVIDOV.SAI[MF,DEK]/1P/19L
1)	C00096 00017	The main dopage procedure
1)	C00113 00018	procedure pageout # the main output procedure,produces one page
1)	C00116 00019	procedure closeout # just before stopping, do this
1)	C00121 00020	Main routine
1)	C00124 ENDMK
1)	C⊗;
1)	begin "DVIDOV"
1)	comment					First Written:	May 21 1982 (IAZ)
1)						Last Updates:	Oct 11 1982 (IAZ)
1)								Apr 08 1984 (DEK)
1)	Modified for Tops-20/Sail conditional compilation by Leonard N. Zubkoff
1)	(Zubkoff@CMU-20C) on October 11, 1982. Modified by DEK to bring it into
1)	consistency with DVItype (Version 2.3) on April 8, 1984.
1)	This program converts a .DVI file (in version 2 format) into a .PRE file
1)	and sends it to the Dover printer.
1)	DVIDOV makes sure that the spooler has accepted the file and returns.
**** File 2) DVIDOV.SAI[1,JDH]/1P/19L
2)	C00098 00017	The main dopage procedure
2)	C00115 00018	procedure pageout # the main output procedure,produces one page
2)	C00118 00019	procedure closeout # just before TEX stops, do this
2)	C00123 00020	Main routine
2)	C00126 ENDMK
2)	C⊗;
2)	begin "DVIDOV"
2)	comment					First Written:	 May 21 1982. (IAZ)
2)						Last Update: Oct 11 1982 (IAZ)
2)	Modified for Tops-20/Sail conditional compilation by Leonard N. Zubkoff
2)	(Zubkoff@CMU-20C) on October 11, 1982.
2)	This program converts a .DVI file (in version 2 format) into a .PRE file
2)	and sends it to the Dover priter.
2)	DVIDOV makes sure that the spooler has accepted the file and returns.
***************


**** File 1) DVIDOV.SAI[MF,DEK]/3P/76L
1)	saf integer array texcounter[0:9] # contents of TeX counters at beginning of page;
1)	integer curpage # current page being processed;
**** File 2) DVIDOV.SAI[1,JDH]/3P/76L
2)	saf integer array texcounter[0:9] # contents of TEX counters at beginning of page;
2)	integer curpage # current page being processed;
***************


**** File 1) DVIDOV.SAI[MF,DEK]/11P/28L
1)	What constitutes an "entity" in a page of TeX output is not clear. One view
1)	would treat each TeX "box" as an entity, but this would entail an absurd amount
1)	of overhead, since even single characters are packaged in individual boxes.
  1) DVIDOV.SAI[MF,DEK] and 2) DVIDOV.SAI[1,JDH]	4-08-84 16:25	pages 11,11

**** File 2) DVIDOV.SAI[1,JDH]/11P/28L
2)	What constitutes an "entity" in a page of TEX output is not clear. One view
2)	would treat each TEX "box" as an entity, but this would entail an absurd amount
2)	of overhead, since even single characters are packaged in individual boxes.
***************


**** File 1) DVIDOV.SAI[MF,DEK]/13P/35L
1)	s←InputLine # gets the users command line that started us up;
1)	loop
**** File 2) DVIDOV.SAI[1,JDH]/13P/35L
2)	s←InputLine # gets the users command line that started up TEX;
2)	loop
***************


**** File 1) DVIDOV.SAI[MF,DEK]/13P/64L
1)	s←InputLine # gets the users command line that started us up;
1)	scan(s,oneword,chr);
**** File 2) DVIDOV.SAI[1,JDH]/13P/64L
2)	s←InputLine # gets the users command line that started up TEX;
2)	scan(s,oneword,chr);
***************


**** File 1) DVIDOV.SAI[MF,DEK]/16P/2L
1)		
1)	recursive procedure outvecstring(integer dx,dy,o);
1)		comment Output character codes for font NEWVEC that the
1)		Dover will use to draw a vector. dx and dy are Dover pixels.
1)		o is 0,1,2 or 3 depending on the octant in which the piece will lay.;
1)	begin
1)	if (dx≥32 or dy≤-32 or dy≥32) then
1)		begin
1)		outvecstring(dx div 2,dy div 2,o);
1)		outvecstring(dx-(dx div 2),dy-(dy div 2),o);
1)		return;
1)		end;
1)	case o of
1)		begin "cases"
1)		[0]	begin
1)			if dy≥16 then
1)				begin
1)				o←((dx*16)/dy)+.5;
1)				DLByte(o);
1)				dy←dy-16;
1)				dx←dx-o;
1)				end;
  1) DVIDOV.SAI[MF,DEK] and 2) DVIDOV.SAI[1,JDH]	4-08-84 16:25	pages 16,16

1)			if dy≥8 then
1)				begin
1)				o←((dx*8)/dy)+.5;
1)				DLByte('120+o);
1)				dy←dy-8;
1)				dx←dx-o;
1)				end;
1)			if dy≥4 then
1)				begin
1)				o←((dx*4)/dy)+.5;
1)				DLByte('170+o);
1)				dy←dy-4;
1)				dx←dx-o;
1)				end;
1)			if dy≥2 then
1)				begin
1)				o←((dx*2)/dy)+.5;
1)				DLByte('214+o);
1)				dy←dy-2;
1)				dx←dx-o;
1)				end;
1)			if dy≥1 then
1)				begin
1)				o←(dx/dy)+.5;
1)				DLByte('226+o);
1)				dy←dy-1;
1)				dx←dx-o;
1)				end;
1)			end;
1)		[1][2]	begin
1)			if dx≥16 then
1)				begin
1)				o←((dy*16)/dx)+.5;
1)				DLByte('40-o);
1)				dx←dx-16;
1)				dy←dy-o;
1)				end;
1)			if dx≥8 then
1)				begin
1)				o←((dy*8)/dx)+.5;
1)				DLByte('140-o);
1)				dx←dx-8;
1)				dy←dy-o;
1)				end;
1)			if dx≥4 then
1)				begin
1)				o←((dy*4)/dx)+.5;
1)				DLByte('200-o);
  1) DVIDOV.SAI[MF,DEK] and 2) DVIDOV.SAI[1,JDH]	4-08-84 16:25	pages 16,16

1)				dx←dx-4;
1)				dy←dy-o;
1)				end;
1)			if dx≥2 then
1)				begin
1)				o←((dy*2)/dx)+.5;
1)				DLByte('220-o);
1)				dx←dx-2;
1)				dy←dy-o;
1)				end;
1)			if dx≥1 then
1)				begin
1)				o←(dy/dx)+.5;
1)				DLByte('230-o);
1)				dx←dx-1;
1)				dy←dy-o;
1)				end;
1)			end;
1)		[3]	begin
1)			if dy≤-16 then
1)				begin
1)				o←((dx*16)/dy)+.5;
1)				DLByte('100+o);
1)				dy←dy+16;
1)				dx←dx+o;
1)				end;
1)			if dy≤-8 then
1)				begin
1)				o←((dx*8)/dy)+.5;
1)				DLByte('160+o);
1)				dy←dy+8;
1)				dx←dx+o;
1)				end;
1)			if dy≤-4 then
1)				begin
1)				o←((dx*4)/dy)+.5;
1)				DLByte('210+o);
1)				dy←dy+4;
1)				dx←dx+o;
1)				end;
1)			if dy≤-2 then
1)				begin
1)				o←((dx*2)/dy)+.5;
1)				DLByte('224+o);
1)				dy←dy+2;
1)				dx←dx+o;
1)				end;
1)			if dy≤-1 then
  1) DVIDOV.SAI[MF,DEK] and 2) DVIDOV.SAI[1,JDH]	4-08-84 16:25	pages 16,16

1)				begin
1)				o←(dx/dy)+.5;
1)				DLByte('232+o);
1)				dy←dy+1;
1)				dx←dx+o;
1)				end;
1)			end;
1)		else comment Impossible!;
1)		end "cases";
1)	end;
**** File 2) DVIDOV.SAI[1,JDH]/16P/4L
2)	simple integer procedure veclength(integer x);
2)		comment Find the longest vector length less than x for which
2)		there are NEWVEC characters.  Possibilities are 1, 2, 4, 8, 16;
2)	if x≥16 then return(16)
2)	 else if x≥8 then return(8)
2)	       else if x≥4 then return(4)
2)		     else if x≥2 then return(2)
2)			   else return(1);
2)		
2)	procedure outvecstring(integer dx,dy,fontposfactor);
2)		comment Output character codes for font NEWVEC that the
2)		Dover will use to draw a vector. dx and dy are Dover pixels and
2)		0 ≤ abs(dy) ≤ dx.  fontposfactor determines where the vectors are
2)		located in the NEWVEC font.  Vectors of length k are centered around
2)		position '240 - k*fontposfactor for k = 1, 2, 4, 8, 16;
2)	begin
2)	integer curx		# x position ranging from 0 to dx;
2)	integer oldy, newy;	# y positions before and after adding the last vector;
2)	integer xstep		# x component of current vector (usually 16);
2)	curx ← 0;
2)	oldy ← 0;
2)	while curx < dx
2)	 do begin
2)	    xstep ← veclength(dx-curx);
2)	    curx ← curx + xstep;
2)	    newy ← curx*dy/dx + .5;
2)	    DLByte('240 - xstep*fontposfactor + (oldy-newy));
2)	    oldy ← newy;
2)	    end;
2)	end;
***************


**** File 1) DVIDOV.SAI[MF,DEK]/16P/134L
1)		Coordinates are internal DVI units (unmagnified).
1)		This procedure sets thing up and calls
**** File 2) DVIDOV.SAI[1,JDH]/16P/39L
  1) DVIDOV.SAI[MF,DEK] and 2) DVIDOV.SAI[1,JDH]	4-08-84 16:25	pages 16,16

2)		Coordinates are micas.
2)		This procedure sets thing up and calls
***************


**** File 1) DVIDOV.SAI[MF,DEK]/16P/142L
1)	real r;
1)	integer o;
1)	oldfont←curfont;
**** File 2) DVIDOV.SAI[1,JDH]/16P/47L
2)	integer fontposfactor # length k vectors are centered around font position
2)				'240 - k*fontposfactor;
2)	oldfont←curfont;
***************


**** File 1) DVIDOV.SAI[MF,DEK]/16P/163L
1)	setX(pixelround(xt));
1)	setY(pixelround(yt));
1)	comment Now set target position relative to current position (in Dover pixels);
1)	dx←(dpixPerRSU*unitscale*(xh-xt)*magnification)/1000;
1)	dy←(dpixPerRSU*unitscale*(yt-yh)*magnification)/1000;
1)		comment substract the other way round to get cartesian perspective;
**** File 2) DVIDOV.SAI[1,JDH]/16P/68L
2)	setX(xt);
2)	setY(yt);
2)	comment Now set target position relative to current position (in Dover pixels);
2)	dx←(xh-xt)/micasPerDPix+.5;
2)	dy←(yt-yh)/micasPerDPix+.5;
2)		comment substract the other way round to get cartesian perspective;
***************


**** File 1) DVIDOV.SAI[MF,DEK]/16P/171L
1)			"xt=",xt*dvitoprint,
1)			", yt=",yt*dvitoprint,
1)			", xh=",xh*dvitoprint,
1)			", yh=",yh*dvitoprint,
1)			", ps=",vsize[i],")");
1)	comment Let's identify the four octants by 0,1,2 and 3;
1)	if dx=0 then r←dy else r←dy/dx;
1)	if r>0 then
1)		begin
1)		if r>1 then o←0 else o←1;
1)		end
1)	else
1)		begin
1)		if r<-1 then o←3 else o←2;
  1) DVIDOV.SAI[MF,DEK] and 2) DVIDOV.SAI[1,JDH]	4-08-84 16:25	pages 16,16

1)		end;
1)	outvecstring(dx,dy,o);
1)	cx[en]←pixelround(xh);
**** File 2) DVIDOV.SAI[1,JDH]/16P/76L
2)			"xt=",xt*micastoprint,
2)			", yt=",yt*micastoprint,
2)			", xh=",xh*micastoprint,
2)			", yh=",yh*micastoprint,
2)			", ps=",vsize[i],")");
2)	fontposfactor ← '10;
2)	if dy>dx
2)	 then begin fontposfactor ← '12; dx ↔ dy; dy ← -dy; end
2)	 else if dy<-dx
2)	       then begin fontposfactor ← 6; dx ↔ dy; dx ← -dx; end;
2)	comment Now dx≥0 and abs(dy)≤dx;
2)	outvecstring(dx,dy,fontposfactor);
2)	cx[en]←pixelround(xh);
***************


**** File 1) DVIDOV.SAI[MF,DEK]/16P/204L
1)		width w and height h. (Dimensions are internal - unmagnified - DVI units.)
1)		Fill it with the given texture (txre has 4 4bit lines in 16 bits).
**** File 2) DVIDOV.SAI[1,JDH]/16P/105L
2)		width w and height h. (Dimensions are micas.)
2)		Fill it with the given texture (txre has 4 4bit lines in 16 bits).
***************


**** File 1) DVIDOV.SAI[MF,DEK]/16P/220L
1)		print(nextline,"OUTRECT(lx=",lx*dvitoprint,
1)			" by= ",by*dvitoprint,
1)			" w=",w*dvitoprint," h=",h*dvitoprint,
1)			" txre=",txre," pmod=",pmod,")");
**** File 2) DVIDOV.SAI[1,JDH]/16P/121L
2)		print(nextline,"OUTRECT(lx=",lx*micastoprint,
2)			" by= ",by*micastoprint,
2)			" w=",w*micastoprint," h=",h*micastoprint,
2)			" txre=",txre," pmod=",pmod,")");
***************


**** File 1) DVIDOV.SAI[MF,DEK]/16P/226L
1)	setX(pixelround(lx));
1)	setY(pixelround(by));
1)	pmod←ELShowDots;
**** File 2) DVIDOV.SAI[1,JDH]/16P/127L
2)	setX(lx);
  1) DVIDOV.SAI[MF,DEK] and 2) DVIDOV.SAI[1,JDH]	4-08-84 16:25	pages 16,16

2)	setY(by);
2)	pmod←ELShowDots;
***************


**** File 1) DVIDOV.SAI[MF,DEK]/16P/244L
1)	pw←(((w*unitscale*apixPerRSU*magnification)/1000+15) div 16)*16;
1)		comment must be a multiple of 16 and should fit in 16 bits;
1)	DLByte(pw div 256); DLByte(pw mod 256); comment `dots' in two bytes;
1)	ph←(h*unitscale*apixPerRSU*magnification)/1000;
1)	comment if ((pw land '20) and (ph land '1)) then ph←ph+1;
**** File 2) DVIDOV.SAI[1,JDH]/16P/145L
2)	pw←(((w*unitscale*apixPerRSU*magnification/conv)/1000+15) div 16)*16;
2)		comment must be a multiple of 16 and should fit in 16 bits;
2)	DLByte(pw div 256); DLByte(pw mod 256); comment `dots' in two bytes;
2)	ph←(h*unitscale*apixPerRSU*magnification/conv)/1000;
2)	comment if ((pw land '20) and (ph land '1)) then ph←ph+1;
***************


**** File 1) DVIDOV.SAI[MF,DEK]/17P/9L
1)		comment remembered positions for extensions (in DVI units);
1)	integer procedure firstpar(integer o);
**** File 2) DVIDOV.SAI[1,JDH]/17P/9L
2)		comment remembered positions for extensions (in micas);
2)	integer procedure firstpar(integer o);
***************


**** File 1) DVIDOV.SAI[MF,DEK]/17P/56L
1)		has gone outside the box. (In TeX you can do that using negative glue.);
1)	hh←pixelround(h); vv←pixelround(v);
**** File 2) DVIDOV.SAI[1,JDH]/17P/56L
2)		has gone outside the box. (In TEX you can do that using negative glue.);
2)	hh←pixelround(h); vv←pixelround(v);
***************


**** File 1) DVIDOV.SAI[MF,DEK]/17P/198L
1)						hcoord[pindex]←h;
1)						vcoord[pindex]←v;
1)						DEBUGONLY if (DEBUG land dvicommands) then
1)							print("[index=",pindex,
1)								" h=",h*dvitoprint,
1)								" v=",v*dvitoprint,"]");
1)						end;
**** File 2) DVIDOV.SAI[1,JDH]/17P/198L
2)						hcoord[pindex]←hh;
  1) DVIDOV.SAI[MF,DEK] and 2) DVIDOV.SAI[1,JDH]	4-08-84 16:25	pages 17,17

2)						vcoord[pindex]←vv;
2)						DEBUGONLY if (DEBUG land dvicommands) then
2)							print("[index=",pindex,
2)								" hh=",hh*micastoprint,
2)								" vv=",vv*micastoprint,"]");
2)						end;
***************


**** File 1) DVIDOV.SAI[MF,DEK]/17P/214L
1)						h←hcoord[pindex];
1)						v←vcoord[pindex];
1)						end;
**** File 2) DVIDOV.SAI[1,JDH]/17P/214L
2)						h ← (hh←hcoord[pindex])/conv + .5;
2)						v ← (vv←vcoord[pindex])/conv + .5;
2)						end;
***************


**** File 1) DVIDOV.SAI[MF,DEK]/19P/1L
1)	procedure closeout # just before stopping, do this;
1)	begin integer n,f;
**** File 2) DVIDOV.SAI[1,JDH]/19P/1L
2)	procedure closeout # just before TEX stops, do this;
2)	begin integer n,f;
***************